<template>
  <div>
    <datail-bunner :sightName="sightName" :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></datail-bunner>
    <datail-header></datail-header>
    <div class="content">
      <datail-list :list="list"></datail-list>
    </div>
  </div>
</template>

<script>
import DatailBunner from './components/Banner'
import DatailHeader from './components/Header'
import DatailList from './components/List'
import axios from 'axios'
export default {
  name: 'Datail',
  data () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      gallaryImgs: []
    }
  },
  components: {
    DatailBunner,
    DatailHeader,
    DatailList
  },
  methods: {
    getDatailInfo () {
      axios.get(`/api/datail.json`, {
        params: {
          id: this.$route.params.id
        }
      })
        .then(this.setDatailInfo)
        .catch((e) => {
          console.log(e)
        })
    },
    setDatailInfo (res) {
      console.log(res)
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        this.list = data.categoryList
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
      }
    }
  },
  mounted () {
    this.getDatailInfo()
  }
}
</script>

<style lang="stylus" scoped>
.content
  height: 50rem
</style>
